package org.dfg.corejava.jdk8.time;

import java.time.Clock;
import java.time.ZoneId;

public class ClockTest {

    public static void main(String[] arg) {
        Clock c1 = Clock.systemUTC();//获取系统utc时钟
        long millis = c1.millis(); //utc时间，相当于System.currentTimeMillis()
        System.out.println(millis);
        System.out.println(System.currentTimeMillis());
        
        Clock c2 = Clock.systemDefaultZone();
        System.out.println(c2.getZone());
        Clock c3 = Clock.system(ZoneId.of("Europe/Paris"));
        Clock c4 = Clock.system(ZoneId.of("Asia/Shanghai"));
        System.out.println(c3.instant());
        System.out.println(c4.instant());
    }
}
